{% extends 'index.html' %}
{% block page-content %}
<div id="page-wrapper">
    <div class="row">
         <div class="col-lg-12">
              <h1 class="page-header"><i class="fa  fa-align-justify "></i> 项目列表</h1>
         </div>
                <!-- /.col-lg-12 -->
    </div>
	<div class="row">
        <div class="col-lg-6 col-md-9">
            <div class="panel panel-default">
                <div class="panel-heading">
                <i class="fa  fa-plus"></i> 添加流水线
                </div>
                <div class="panel-body">
                    <div class="row">
                        <for class="col-lg-12">
                        
                            <form role="form" id="addForm" method="post">  
                                {% csrf_token %}
                                <div class="form-group">
                                    <label>流水线名称</label>
                                    <input class="form-control" name="flowline_name" required pattern="^[A-Za-z]+$" title="只支持英文格式">
                                </div>                           
                                
                                <button type="reset" class="btn btn-default">撤销</button>
                               <input type="button" onclick="addForm(this)" value="提交">
                            
                            </form>
                        </for>
                                                        
                       </form> 
                    </div>
                    <!-- /.row (nested) -->
                </div>
                <!-- /.panel-body -->
            </div>
            <!-- /.panel -->
        </div>
     </div>     
    <div class="row">
        <div class="col-lg-10 col-md-10">


            <table class="table table-bordered">
              <caption>流水线列表</caption>
              <thead>
                <tr>
                  <th>序号</th>
                  <th>流水线</th>
                  <th>创建时间</th>
                  <th>创建人</th>
                </tr>
              </thead>
              <tbody>
               {% for flowline in oFlowline %}
                <tr>
                  <td>{{ flowline.id }}</td>
                  <td>{{ flowline.flowline_name }}</td>
                  <td>{{ flowline.create_time }}</td>
                  <td>{{ flowline.founder_id }}</td>
                </tr>
               {% endfor %}
              </tbody>
            </table>

            <ul class="list-group">
       
            <li class="list-group-item">{{ flowline.flowline_name }}</li>
         
            </ul>
        </div>
    </div>
</div>
<script>
function addForm(oDom){
  $(oDom).attr({"disabled":"disabled"});
    $.ajax({
        url : 'add_flowline',
        type : 'post',
        dataType : 'json',
        data: $("#addForm").serialize(),
        success : function(data){
          $(oDom).removeAttr("disabled");
            if(data == 1){
                layer.alert('添加成功！');
            }
            
        }
    });
}

</script>
{% endblock %}